import request from '@/router/axios';

export const getInspectionitemTree = () => {
  return request({
    url: '/api/mes-product/qms-inspection-item/tree',
    method: 'get',
    params: {}
  });
};

export const getInspectionitemattributeList = (params) => {
  return request({
    url: '/api/mes-product/qms-inspection-item-attribute/list',
    method: 'get',
    params: {
      ...params
    }
  });
};

//获取模板对应的所有检查项
export const getSelectattributeList = (params) => {
  return request({
    url: '/api/mes-product/qms-inspection-item-attribute/selectList',
    method: 'get',
    params: {
      ...params
    }
  });
};

export const getInspectionitemattributeDetail = (params) => {
  return request({
    url: '/api/mes-product/qms-inspection-item-attribute/detail',
    method: 'get',
    params: {
      ...params
    }
  });
};

export const removeInspectionitem = (ids) => {
  return request({
    url: `/api/mes-product/qms-inspection-item-attribute/remove?ids=${ids}`,
    method: 'post'
  });
};

export const addInspectionitem = (row) => {
  return request({
    url: '/api/mes-product/qms-inspection-item-attribute/submit',
    method: 'post',
    data: row
  });
};

export const addOrUpdateInspection = (data) => {
  return request({
    url: '/api/mes-product/qms-inspection-item/submit',
    method: 'post',
    data: data
  });
};

export const delInspection = (ids) => {
  return request({
    url: `/api/mes-product/qms-inspection-item/remove?ids=${ids}`,
    method: 'post'
  });
};

export const getInspectionlist = (params) => {
  return request({
    url: '/api/mes-product/qms-inspection-item/list',
    method: 'get',
    params: params
  });
};

export const getControlType = () => {
  return request({
    url: '/api/blade-system/dict/dictionary?code=control_type',
    method: 'get',
    params: {}
  });
};

export const getInspectionDetail = (params) => {
  return request({
    url: '/api/mes-product/qms-inspection-item/detail',
    method: 'get',
    params: {
      ...params
    }
  });
};

export const getQCType = () => {
  return request({
    url: '/api/blade-system/dict/dictionary?code=QC',
    method: 'get',
    params: {}
  });
};
